package cn.com.wangluotongxin.chat.model.constants;

public enum YesNo {
    NO(0, "否"),
    YES(1, "是");

    private Integer code;

    public Integer getCode() {
        return code;
    }

    private String name;

    public String getName() {
        return name;
    }

    public static YesNo getByCode(Integer code){
        if(code == null){
            return null;
        }else {
            YesNo[] yesNos = values();
            for(YesNo yesNo : yesNos){
                if(yesNo.getCode().equals(code)){
                    return yesNo;
                }
            }
        }
        return null;
    }

    YesNo(Integer code, String name){
        this.code = code;
        this.name = name;
    }
}
